
/**
  ******************************************************************************
  * Copyright 2021 The Microbee Authors. All Rights Reserved.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  * 
  * http://www.apache.org/licenses/LICENSE-2.0
  * 
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * 
  * @file       mb_mission_change_detector.h
  * @author     baiyang
  * @date       2022-10-5
  ******************************************************************************
  */

#pragma once

#ifdef __cplusplus
extern "C"{
#endif

/*----------------------------------include-----------------------------------*/
#include "mb_mission.h"
/*-----------------------------------macro------------------------------------*/
#define mis_change_detect_cmd_max 3
/*----------------------------------typedef-----------------------------------*/
typedef struct Mission_ChangeDetector* mission_change_detector_t;

// command structure
struct Mission_ChangeDetector {
    struct {
        uint32_t last_change_time_ms;       // local copy of last time mission was changed
        uint16_t curr_cmd_index;            // local copy of AP_Mission's current command index
        uint8_t cmd_count;                  // number of commands in the cmd array
        struct Mission_Command cmd[mis_change_detect_cmd_max]; // local copy of the next few mission commands
    } mis_change_detect;
};

/*----------------------------------variable----------------------------------*/

/*-------------------------------------os-------------------------------------*/

/*----------------------------------function----------------------------------*/
// check for changes to mission. returns true if mission has been changed since last check
bool MissionChangeDetector_check_for_mission_change();
/*------------------------------------test------------------------------------*/

#ifdef __cplusplus
}
#endif



